{% extends 'flask_user/public_base.html' %}

{% block content %}
    {% from "common/form_macros.html" import render_field, render_checkbox_field, render_submit_field %}

    <h1 style="line-height: 70px; margin-top: 10%; ">
        <img height="50" style="float: left; margin-right: 2rem" src="/static/images/logo/logo-blue.png">
        {% trans %}Register{% endtrans %}
    </h1>

    <form action="" method="POST" novalidate formnovalidate class="form" role="form" style="margin-bottom: 10em">
        {{ form.hidden_tag() }}

        {# Username or Email #}
        {% set field = form.username if user_manager.enable_username else form.email %}
        <div class="form-group {% if field.errors %}has-error{% endif %}">
            {# Label on left, "Already registered? Sign in." on right #}
            <div class="row">
                <div class="col-xs-6">
                    <label for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
                </div>
                <div class="col-xs-6 text-right">
                    {% if user_manager.enable_register %}
                        <a href="{{ url_for('user.login') }}" tabindex='290'>
                            {% trans %}Already registered? Sign in.{% endtrans %}</a>
                    {% endif %}
                </div>
            </div>
            {{ field(class_='form-control', tabindex=210) }}
            {% if field.errors %}
                {% for e in field.errors %}
                    <p class="help-block">{{ e }}</p>
                {% endfor %}
            {% endif %}
        </div>

        {% if user_manager.enable_email and user_manager.enable_username %}
            {{ render_field(form.email, tabindex=220) }}
        {% endif %}

        {{ render_field(form.password, tabindex=230) }}

        {% if user_manager.enable_retype_password %}
            {{ render_field(form.retype_password, tabindex=240) }}
        {% endif %}

        {{ render_submit_field(form.submit, tabindex=280) }}
    </form>

{% endblock %}